package com.sky.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sky.entity.Dish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper extends BaseMapper<Dish> {
    @Select("select count(id) from dish where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);


    List<Dish> listByCategoryId(Long categoryId);

    @Select("select a.* from dish a left join setmeal_dish b on a.id = b.setmeal_id where b.setmeal_id=#{id}")
    List<Dish> getBySetmealId(Long id);
}
